function checkField(obj,type,nnflag){

	var ret;

	if(nnflag){
		if(!checkFieldNotNull(obj))
			return false
	}

	switch(type){
	case 'username':
		ret = checkFieldUSERNAME(obj);
		break;
	case 'password':
		ret = checkFieldPASSWORD(obj);
		break;
	default:
		break;
	}
	if(ret)
		showFieldError(obj,"Ok","Green");

	return ret;
}

function checkFieldNotNull(obj){
	var val = ((obj.value==null) || (obj.value==""));
	if(val){
		showFieldError(obj,"Empty Value not allowed","Red");
		return false;
	}
	return true;
}

function showFieldError(obj,text,color){
	var msgBox = document.getElementById(obj.id+"Message");

	msgBox.style.color= color;
	msgBox.innerHTML= text;
}

function checkLength(obj,len){
	var val = obj.value.length;
	if(val < len){
		return false;
	}
	return true;
}


